package com.example.tomcatdemo.tools;


import java.sql.Connection;
import java.sql.DriverManager;





    public class JDBCTool {

        public static Connection getConnection() throws Exception{
            // 加载第三方mysql的驱动类
            Class.forName("com.mysql.cj.jdbc.Driver");
            String username = "root";
            String password = "123456";
            String url = "jdbc:mysql://127.0.0.1:3306/production?characterEncoding=UTF-8&useSSL=false&useUnicode=true&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true";
            Connection conn = DriverManager.getConnection(url, username, password);
            return conn;
        }

    }







